package betAndWin.application.thread;

import betAndWin.application.GameControl;



public class PriorityThread extends Thread {
		
	private HorseThread horse;
	
	public PriorityThread(HorseThread pHorse) {
		this.horse = pHorse;
	}

	public void run() {
		while (true) {
			try {
				Thread.sleep(GameControl.PRIORITY_DELAY);
			} catch (InterruptedException e) {
				return;
			}
			synchronized (this) {			// sincronizzo l'update della priority con la lettura della priority fatta dall'HorseThread
				horse.updatePriority();
			}
		}
	}
}
